package net.huashitong.Indicators.web;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.sirdc.modules.core.web.JsonBaseController;
import com.sirdc.modules.core.web.model.Message;

import net.huashitong.Indicators.service.CompletionClassificationService;
import net.huashitong.Indicators.service.IndicatorBreakdownService;
import net.huashitong.scheduling.service.FinanceIncomeService;
import net.huashitong.scheduling.service.FinanceRevenueService;
import net.huashitong.scheduling.service.IndustryRevenueService;
@Controller
@RequestMapping("/app/economicSubject")
public class EconomicSubjectController extends JsonBaseController {
	@Autowired
	private IndicatorBreakdownService indicatorBreakdownService;
	@Autowired
	private CompletionClassificationService completionClassificationService;
	@Autowired
	private IndustryRevenueService industryRevenueService;
	@Autowired
	private FinanceIncomeService financeIncomeService;
	@Autowired
	private FinanceRevenueService financeRevenueService;
	@Override
	protected String getView(String arg0) {
		// TODO Auto-generated method stub
		return null;
	}
	
	@ResponseBody
	@RequestMapping(value = "queryDQSCZH")
	public Message queryDQSCZH(){
		Map<String, Object> map = new HashMap<>();
		List<Map<String, Object>> GrossRegionalProductRank =indicatorBreakdownService.queryByIndustryId("A01") ;
		Map<String, Object> GrossRegionalProductIncrease = indicatorBreakdownService.queryIndicatorBreakdownByIndustryId("A01");
	    List<Map<String, Object>> SupportingRegionalProductRank = completionClassificationService.querySupportingRegionalProductRank();
		//地区生产总值（GDP）全市县区排名情况
		map.put("GrossRegionalProductRank", GrossRegionalProductRank);
		//地区生产总值（GDP）累计完成值及同比增长情况
		map.put("GrossRegionalProductIncrease", GrossRegionalProductIncrease);
		//扶贫县GDP排名
		map.put("SupportingRegionalProductRank", SupportingRegionalProductRank);
		
		
		
		return coverMessage("200","成功获取数据", map);
	}
	
	@ResponseBody
	@RequestMapping(value="queryCYQSXQPM")
	public Message queryCYQSXQPM(){
		Map<String, Object> map = new HashMap<>();
		List<Map<String, Object>> IndustryRarkone = indicatorBreakdownService.queryByIndustryId("A02");
		Map<String, Object> IndustryProductIncreaseone = indicatorBreakdownService.queryIndicatorBreakdownByIndustryId("A02");
		List<Map<String, Object>> IndustryRarktwo = indicatorBreakdownService.queryByIndustryId("A03");
		Map<String, Object> IndustryProductIncreasetwo = indicatorBreakdownService.queryIndicatorBreakdownByIndustryId("A03");
		List<Map<String, Object>> IndustryRarkthree = indicatorBreakdownService.queryByIndustryId("A06");
		Map<String, Object> IndustryProductIncreasethree = indicatorBreakdownService.queryIndicatorBreakdownByIndustryId("A06");
		
		//第一产业全市县区排名情况
		map.put("IndustryRarkone", IndustryRarkone);
		//第一产业累计完成值及同比增长情况
		map.put("IndustryProductIncreaseone", IndustryProductIncreaseone);
		
		//第二产业全市县区排名情况
		map.put("IndustryRarktwo", IndustryRarktwo);
		//第二产业累计完成值及同比增长情况
		map.put("IndustryProductIncreasetwo", IndustryProductIncreasetwo);
		
		//第三产业全市县区排名情况
		map.put("IndustryRarkthree", IndustryRarkthree);
		//第三产业累计完成值及同比增长情况
		map.put("IndustryProductIncreasethree", IndustryProductIncreasethree);
		
		
		return coverMessage("200","成功获取数据", map);
		
	}
	@ResponseBody
	@RequestMapping(value="queryHYZJZJZPM")
	public Message queryHYZJZJZPM(){
		Map<String, Object> map = new HashMap<>();
		List<Map<String, Object>> IndustryIncreaseRankone = indicatorBreakdownService.queryByIndustryId("A04");
		Map<String, Object> IndustryComulativeIncreaseone = indicatorBreakdownService.queryIndicatorBreakdownByIndustryId("A04");
		List<Map<String, Object>> IndustryIncreaseRanktwo = indicatorBreakdownService.queryByIndustryId("A05");
		Map<String, Object> IndustryComulativeIncreasetwo = indicatorBreakdownService.queryIndicatorBreakdownByIndustryId("A05");
		
		//建筑业增加值全市县区排名情况
		map.put("IndustryIncreaseRankone", IndustryIncreaseRankone);
		//建筑业增加值累计完成值及同比增长情况
		map.put("IndustryComulativeIncreaseone", IndustryComulativeIncreaseone);
		
		//规模以上工业增加值全市县区排名情况
		map.put("IndustryIncreaseRanktwo", IndustryIncreaseRanktwo);
		//规模以上工业增加值累计完成值及同比增长情况
		map.put("IndustryComulativeIncreasetwo", IndustryComulativeIncreasetwo);
		
		return coverMessage("200","成功获取数据", map);
		
	}
	
	@ResponseBody
	@RequestMapping(value="queryGDZCTZPM")
	public Message queryGDZCTZPM(){
		Map<String, Object> map = new HashMap<>();
		List<Map<String, Object>> FixedAssetsInvestmentTotalRank = indicatorBreakdownService.queryByIndustryId("A07");
		Map<String, Object> FixedAssetsInvestmentTotalIncrease = indicatorBreakdownService.queryIndicatorBreakdownByIndustryId("A07");
		List<Map<String, Object>> IndustryFixedAssetsInvestmentRank = indicatorBreakdownService.queryByIndustryId("A08");
		Map<String, Object> IndustryFixedAssetsInvestmentIncrease = indicatorBreakdownService.queryIndicatorBreakdownByIndustryId("A08");
		
		//固定资产投资总额全市县区排名情况
		map.put("FixedAssetsInvestmentTotalRank", FixedAssetsInvestmentTotalRank);
		//固定资产投资总额累计完成值及同比增长情况
		map.put("FixedAssetsInvestmentTotalIncrease", FixedAssetsInvestmentTotalIncrease);
		//工业固定资产投资全市县区排名情况
		map.put("IndustryFixedAssetsInvestmentRank", IndustryFixedAssetsInvestmentRank);
		//工业固定资产投资累计完成值及同比增长情况
		map.put("IndustryFixedAssetsInvestmentIncrease", IndustryFixedAssetsInvestmentIncrease);
		

		return coverMessage("200","成功获取数据", map);
		
	}
	
	@ResponseBody
	@RequestMapping(value="querySHXFPLSYZEPM")
	public Message querySHXFPLSYZEPM(){
		Map<String, Object> map = new HashMap<>();
		List<Map<String, Object>> SocietyConsumptionRetailRank = indicatorBreakdownService.queryByIndustryId("A13");
		Map<String, Object> SocietyConsumptionRetailIncrease = indicatorBreakdownService.queryIndicatorBreakdownByIndustryId("A13");
		
		//社会消费品零售业总额全市县区排名情况
		map.put("SocietyConsumptionRetailRank", SocietyConsumptionRetailRank);
		//社会消费品零售业总额累计完成值及同比增长情况
		map.put("SocietyConsumptionRetailIncrease", SocietyConsumptionRetailIncrease);
		
		return coverMessage("200","成功获取数据", map);
	}
	
	@ResponseBody
	@RequestMapping(value="querySRWCQK")
	public Message querySRWCQK(){
		Map<String, Object> map = new HashMap<>();
		List<Map<String, Object>> RevenueIncomeComplete = industryRevenueService.queryIndustryRevenueList();
		List<Map<String, Object>> FinancialIncomeComplete =financeIncomeService.queryFinancialIncomeComplete();
		List<Map<String, Object>> FinancialMainIndexAssess = financeRevenueService.queryFinancialMainIndexAssess();
		List<Map<String, Object>> CommonalityBudgetTotalIncomeRank =indicatorBreakdownService.queryByIndustryId("A09");
		Map<String, Object> CommonalityBudgetTotalIncomeIncrease = indicatorBreakdownService.queryIndicatorBreakdownByIndustryId("A09");
		List<Map<String, Object>> CommonalityBudgetIncomeRank = indicatorBreakdownService.queryByIndustryId("A10");
		Map<String, Object> CommonalityBudgetIncomeIncrease = indicatorBreakdownService.queryIndicatorBreakdownByIndustryId("A10");
		List<Map<String, Object>> ExportTotaValueRank = indicatorBreakdownService.queryByIndustryId("A14");
		Map<String, Object> ExportTotaValueIncrease = indicatorBreakdownService.queryIndicatorBreakdownByIndustryId("A14");
		List<Map<String, Object>> RealityUseForeignCapitalRank = indicatorBreakdownService.queryByIndustryId("A15");
		Map<String, Object> RealityUseForeignCapitalIncrease = indicatorBreakdownService.queryIndicatorBreakdownByIndustryId("A15");
	
		//税收收入完成情况
		map.put("RevenueIncomeComplete", RevenueIncomeComplete);
		
		
		//财政收入完成情况
		map.put("FinancialIncomeComplete", FinancialIncomeComplete);
		
		
		//财政主要指标考核情况
		map.put("FinancialMainIndexAssess", FinancialMainIndexAssess);
		
		
		//一般公共预算总收入全市县区排名情况
		map.put("CommonalityBudgetTotalIncomeRank", CommonalityBudgetTotalIncomeRank);
		//一般公共预算总收入累计完成值及同比增长情况
		map.put("CommonalityBudgetTotalIncomeIncrease", CommonalityBudgetTotalIncomeIncrease);
		//一般公共预算收入全市县区排名情况
		map.put("CommonalityBudgetIncomeRank", CommonalityBudgetIncomeRank);
		//一般公共预算收入累计完成值及同比增长情况
		map.put("CommonalityBudgetIncomeIncrease", CommonalityBudgetIncomeIncrease);
		//进出口总值全市县区排名情况
		map.put("ExportTotaValueRank", ExportTotaValueRank);
		//进出口总值累计完成值及同比增长情况
		map.put("ExportTotaValueIncrease", ExportTotaValueIncrease);
		//实际利用外资县区排名情况
		map.put("RealityUseForeignCapitalRank", RealityUseForeignCapitalRank);
		//实际利用外资累计完成值及同比增长情况
		map.put("RealityUseForeignCapitalIncrease", RealityUseForeignCapitalIncrease);
		
		
		return coverMessage("200","成功获取数据", map);
		
	}
	
	@ResponseBody
	@RequestMapping(value="queryJMRJSRPM")
	public Message queryJMRJSRPM(){
		Map<String, Object> map = new HashMap<>();
		List<Map<String, Object>> ResidentPerCapitaGovernIncomeRankone = indicatorBreakdownService.queryByIndustryId("A19");
		Map<String, Object> ResidentPerCapitaGovernIncomeIncreaseone = indicatorBreakdownService.queryIndicatorBreakdownByIndustryId("A19");
		List<Map<String, Object>> ResidentPerCapitaGovernIncomeRanktwo = indicatorBreakdownService.queryByIndustryId("A18");
		Map<String, Object> ResidentPerCapitaGovernIncomeIncreasetwo = indicatorBreakdownService.queryIndicatorBreakdownByIndustryId("A18");
		
		//农村居民人均可支配收入县区排名情况
		map.put("ResidentPerCapitaGovernIncomeRankone", ResidentPerCapitaGovernIncomeRankone);
		//农村居民人均可支配收入累计完成值及同比增长情况
		map.put("ResidentPerCapitaGovernIncomeIncreaseone", ResidentPerCapitaGovernIncomeIncreaseone);
		//城镇居民人均可支配收入县区排名情况
		map.put("ResidentPerCapitaGovernIncomeRanktwo", ResidentPerCapitaGovernIncomeRanktwo);
		//城镇居民人均可支配收入累计完成值及同比增长情况
		map.put("ResidentPerCapitaGovernIncomeIncreasetwo", ResidentPerCapitaGovernIncomeIncreasetwo);
		
		
		return coverMessage("200","成功获取数据", map);
	
	}
	
	
}
